UNIX Power Tools, 3rd Edition by Jerry Peek;Shelley Powers;Tim O'Reilly;Mike Loukides
Author:Jerry Peek;Shelley Powers;Tim O'Reilly;Mike Loukides
Format: mobi
Tags: COMPUTERS / Operating Systems / UNIX
Publisher: O'Reilly Media
Published: 2009-02-09T00:00:00+00:00
is exactly the same as typing:
% lpr
file1 file2 file3 file4 file5
In this case everything works as expected. But there are other situations in which wildcards don't work at all. Assume you want to read some files from a tape, which requires the command tar x (Section 38.6), so you type the command tar x *.txt. Will you be happy or disappointed?
You'll be disappointed — unless older versions of the files you want are already in your current directory (Section 1.16). The shell expands the wildcard *.txt, according to what's in the current directory, before it hands the completed command line over to tar for execution. All tar gets is a list of files. But you're probably not interested in the current directory; you probably want the wildcard * to be expanded on the tape, retrieving any *.txt files that the tape has.
There's a way to pass wildcards to programs, without having them interpreted by the shell. Simply put *.txt in quotes (Section 27.12). The quotes prevent the Unix shell from expanding the wildcard, passing it to the command unchanged. Programs that can be used in this way (like ssh and scp (Section 46.6)) know how to handle wildcards, obeying the same rules as the shell (in fact, these programs usually start a shell to interpret their arguments). You only need to make sure that the programs see the wildcards, that they aren't stripped by the shell before it passes the command line to the program. As a more general rule, you should be aware of when and why a wildcard gets expanded, and you should know how to make sure that wildcards are expanded at an appropriate time.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Secret History by Donna Tartt(18160)
Goodbye, Things by Fumio Sasaki(8291)
Wonder by R. J. Palacio(7742)
Turbulence by E. J. Noyes(7700)
How to Be a Bawse: A Guide to Conquering Life by Lilly Singh(7154)
Kaplan MCAT General Chemistry Review by Kaplan(6595)
The Testaments by Margaret Atwood(6493)
The Thirst by Nesbo Jo(6437)
The Last Wish (The Witcher Book 1) by Andrzej Sapkowski(5213)
Spare by Prince Harry The Duke of Sussex(4786)
On Writing A Memoir of the Craft by Stephen King(4662)
Audition by Ryu Murakami(4613)
The Body: A Guide for Occupants by Bill Bryson(4583)
The Rules Do Not Apply by Ariel Levy(4523)
The Doodle Revolution by Sunni Brown(4502)
Gerald's Game by Stephen King(4374)
Adulting by Kelly Williams Brown(4232)
Millionaire: The Philanderer, Gambler, and Duelist Who Invented Modern Finance by Janet Gleeson(4094)
Housekeeping by Marilynne Robinson(4060)
